package com.xtone.pm.detector;

import java.text.SimpleDateFormat;
import java.util.Calendar;


/**
 * @Description 移动第三方平台
 * @author David
 * @date 2013-5-26 下午12:31:20
 */
public class CmccSmsMmsDetector extends Detector {
	
	
	public String detect(){
		try {
			Calendar calendar=Calendar.getInstance();
			int h=calendar.get(Calendar.HOUR_OF_DAY);
			if(h>6 && h<23){
				String last=getLastRecordTime();
				SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
				long lastRecord=sdf.parse(last).getTime();
				long now=System.currentTimeMillis();
				if(now-lastRecord>interval){
					return "移动第三方平台已经超过"+interval+"分钟没有计费数据，最近一条计费数据时间为："+last+"，请马上检查平台运行状态";
				}
			}
		} catch (Exception e) {
			return "连接移动第三方平台接口异常";
		}
		return "success";
	}
	
	public String getLastRecordTime()throws Exception{
		return "";
	}
}
